package com.djl.homework;


import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;

/**
 * @Author djl
 * @Time 2024/9/29 19:51
 */
public class Ex3 {
    public static void main(String[] args) throws InterruptedException {
        List<Object> combinedUsersList = new ArrayList<>();
        CountDownLatch latch = new CountDownLatch(2);

        Thread thread1 = new Thread(new File("users-1.json", combinedUsersList, latch));
        Thread thread2 = new Thread(new File("users-2.json", combinedUsersList, latch));
        thread1.start();
        thread2.start();

        latch.await();

        for (Object users : combinedUsersList) {
            System.out.println(users);
        }
    }
}
